<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>config </title>

    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
            box-sizing: border-box;
        }

        :root {
            --fontColor: #d82019;
        }

        .clearfix::after {
            content: '';
            display: table;
            clear: both;
        }

        .wfull {
            width: 100%;
        }

        .obc {
            object-fit: cover;
        }

        .hfull {
            height: 100%;
        }
    </style>

</head>
<body>


<style>
    .root {
        width: 80%;
        margin: auto;
    }
</style>
<div class="root">


    <h1> config: 配置 txt 文本文件夹数据源 </h1>

    <input type="text" id="inputtttt" style="padding: 12px; width: 100%;  border: 3px gray solid; font-size: 22px;  ">

    <button onclick="config_txt_folder()" style="font-size: 22px; padding: 12px; float: right;">submit</button>


</div>
</body>
<script th:inline="javascript">


    // console.log([[${all_data}]]);


    function config_txt_folder() {
        let input_V = document.getElementById("inputtttt").value;
        if (input_V.length < 5){
            alert("路径错误")
            return false;
        }
        let api_url = "/config/txt_folder";   // 如果是 django 后端一定需要加上 / 反斜杠
        let postObj = {
            txt_folder : input_V
        };
        fetch(api_url, {
            method: 'POST',
            headers: {'Content-Type': 'application/json',},
            body: JSON.stringify(postObj),
        })
            // .then(response => response.json())  // 解析响应为 json, 解析响应为 json, 无需再 JSON.parse() 解析
            .then(response => response.text())  // 解析响应为 文本
            .then(data => {
                alert(data)
            })
            .catch((error) => {
                console.error('Error:', error);
            });
    }
</script>
</html>